<!DOCTYPE html>
<html style="height:100%;"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta property="qc:admins" content="135340217545216112633">
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=2">
    <meta content="telephone=no" name="format-detection">
    <meta charset="utf-8">
    <meta name="copyright" content="">
    <meta name="Keywords" content="">
    <meta name="description" content="">
    <title>中石化助力青运，一路“油”你</title>
    <link href="__PUBLIC__/Css/common.css" rel="stylesheet" />
	<link href="__PUBLIC__/Css/page.css" rel="stylesheet" />
    </head>
<body>
<div class="page" id="gift">
    <div class="alert_box">
        <!--分享弹窗-->
        <div class="alert_bg_cover" id="share" onclick="closeShare();" style="display: none;">
            <div class="alert_no_box" >
                    <img src="__PUBLIC__/Images/share_bg.png" />
            </div>
        </div>


        <empty name="info">
            <!--弹出礼盒-->
            <div class="alert_bg_cover" id="gainGift">
                <div class="alert_no_box" >
                    <div class="alert_top_gift">
                        <img src="__PUBLIC__/Images/gift_img.png"/>
                    </div>
                    <div class="alert_word_isopen">
                        <img src="__PUBLIC__/Images/word_isopen.png"/>
                    </div>
                    <if condition="$freerest gt 0">
                    <div class="alert_btn_open" onclick="openGift();">
                        <img src="__PUBLIC__/Images/open_gift_btn.png"/>
                    </div>

                    <div class="alert_btn_again"  onclick="playAgain();">

                        <img src="__PUBLIC__/Images/play_again_btn.png"/>

                    </div>
                        <else />
                        <div class="alert_btn_open" onclick="openGift();">
                            <img src="__PUBLIC__/Images/open_gift_btn.png"/>
                        </div>
                    </if>
                    <div class="alert_word_bottom">
                        <p>还可以再玩：<span class="restTimes">{$freerest}</span>次</p>
                    </div>
                </div>
            </div>
        <else/>
            <if condition="$info['prize_id'] eq 0">
                <!--打开礼盒：没有中奖时-->
                <div class="alert_bg_cover" id="noGift">
                    <div class="alert_no_box" >
                        <div class="alert_top_gift">
                            <img src="__PUBLIC__/Images/open_none.png"/>
                        </div>
                        <div class="alert_word_isopen">

                            <if condition="$info['cj_times'] gt 0">


                                <!--还有游戏次数时-->
                                <img class="hasGameNum" style="display: block;" src="__PUBLIC__/Images/word_nogift.png"/>
                            <else/>

                                <!--游戏次数用完时-->
                                <img class="noneGameNum" style="display: block;" src="__PUBLIC__/Images/word_gameover.png"/>
                            </if>
                        </div>

                        <!--<div class="alert_btn_again">-->

                        <if condition="$info['cj_times'] gt 0">
                            <!--还有游戏次数时-->
                            <div class="alert_btn_again">
                                <img class="hasGameNum" style="display: block;margin-bottom:10px;" src="__PUBLIC__/Images/play_again_btn.png" onclick="playAgain();" />
                                <img class="hasGameNum" style="display: block;" onclick="backToIndex();" src="__PUBLIC__/Images/back_index_btn.png"/>
                            </div>
                        <else/>
                            <!--游戏次数用完时-->
                            <div class="alert_back_index">
                                <img class="noneGameNum" style="display: block;" onclick="backIndex();" src="__PUBLIC__/Images/back_index_btn.png"/>
                            </div>
                        </if>
                            <!--</div>-->


                        <div class="alert_word_bottom">
                            <if condition="$info['cj_times'] gt 0">
                                <!--还有游戏次数时-->
                                <p class="hasGameNum" style="display: block;">还可以再玩：<span class="restTimes">{$info['cj_times']}</span>次</p>
                            <else/>
                                <!--游戏次数用完时-->
                                <p class="noneGameNum" style="display: none;">还可再玩：<span class="restTimes">0</span>次</p>
                            </if>
                        </div>
                    </div>
                </div>
            <elseif condition="$info['prize_name'] eq '中石化海龙燃油宝'" />
                <!--恭喜获奖:燃油宝-->
                <div class="alert_bg_cover" id="winGift_ryb">
                    <div class="alert_no_box" >
                        <div class="alert_head">
                            <img src="__PUBLIC__/Images/get_gift.png"/>
                        </div>
                        <div class="alert_prize_content">
                            <ul>
                                <li>
                                    <label>奖品：</label>
                                    <span>{$info['prize_name']}</span>
                                </li>
                                <li>
                                    <label>领取时间：</label>
                                    <span>2015年11月2日-12月31日</span>
                                </li>
                                <li>
                                    <label>领取门店：</label>
                                    <span onclick="lookStores();"><span id="shop_name">（须自行提取）</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;查看></span>
                                </li>
                            </ul>
                        </div>
                        <div class="alert_input_area">
                            <div class="alert_input_phone">
                                <textarea value="" class="alert_input" id="ryb_phone" placeholder="手机号：" name="phone"></textarea>
                            </div>
                        </div>
                        <div class="alert_remind_word">
                            <div style="position: absolute;width: 5%;left: 20%;margin-top: 4px;"><img src="__PUBLIC__/Images/hongd.png"/></div>
                            <p style="color:#ff0000;margin-top:5px;">获奖凭据，务必认真填写</p>
                        </div>
                        <div class="bottom_btn_left" onclick="share();">
                            <img src="__PUBLIC__/Images/alert_share.png"/>
                        </div>
                        <div class="bottom_btn_right" onclick="submit_result()">
                            <img src="__PUBLIC__/Images/alert_sure_btn.png"/>
                        </div>
                    </div>
                </div>
                <else/>
                <!--恭喜获奖:青运会纪念邮折 or 加油卡-->
                <div class="alert_bg_cover" id="winGift_jnyz">
                    <div class="alert_no_box" >
                        <div class="alert_head">
                            <img src="__PUBLIC__/Images/get_gift.png"/>
                        </div>
                        <div class="alert_prize_content">
                            <ul>
                                <li>
                                    <label>奖品：</label>
                                    <span>价值{$info['worth']}元{$info['prize_name']}</span>
                                </li>
                                <li>
                                    <label>领取时间：</label>
                                    <span>2015年11月2日-12月31日</span>
                                </li>
                            </ul>
                        </div>
                        <div class="alert_input_area">
                            <div class="alert_input_receiver">
                                <textarea value="" class="alert_input" id="receiver" placeholder="收件人：" name="receiver"></textarea>
                                <!--<input value="" class="alert_input" id="receiver"  name="receiver" />-->
                            </div>
                            <div class="alert_input_phone">
                                <textarea value="" class="alert_input" id="phone" placeholder="手机号：" name="phone"></textarea>
                            </div>
                            <div class="alert_input_address">
                                <textarea class="alert_input" id="address" name="address" placeholder="收件地址："></textarea>
                            </div>
                        </div>
                        <div class="alert_remind_word">
                            <p style="margin-left:-10px;margin-top:-5px;">由于人数较多，请耐心等待工作人员寄送</p>
                            <div style="position: absolute;width: 5%;left: 20%;margin-top: 4px;"><img src="__PUBLIC__/Images/hongd.png"/></div>
                            <p style="color:#ff0000;margin-top:5px;">获奖凭据，务必认真填写</p>
                        </div>
                        <div class="bottom_btn_left" onclick="share();">
                            <img src="__PUBLIC__/Images/alert_share.png"/>
                        </div>
                        <div class="bottom_btn_right" onclick="submit_result();">
                            <img src="__PUBLIC__/Images/alert_sure_btn.png"/>
                        </div>
                    </div>
                </div>
            </if>
            <input type="hidden" name="shop" value="" />
            <input type="hidden" name="prize_id" value="{$info['prize_id']}"/>
        </empty>
                <!--领奖门店-->
                <div class="alert_bg_cover" id="getPlace" style="display:none;">
                    <div class="alert_no_box" >
                        <div class="alert_head">
                            <img src="__PUBLIC__/Images/get_place.png"/>
                        </div>
                        <div class="alert_prize_content">
                            <ul id="activity_stores">
                                <li>
                                    <p class="store_address">福州北门加油站（鼓楼区福飞南路4号）</p>
                                    <p class="contacter">曾敏 0591-87835645</p>
                                </li>
                                <li>
                                    <p class="store_address">宁德本部中心站（蕉城区和平路1号）</p>
                                    <p class="contacter">黄通明 0593- 2810032</p>
                                </li>
                                <li>
                                    <p class="store_address">莆田中心站（荔城区大坝桥头）</p>
                                    <p class="contacter">余晗  0594-2790774</p>
                                </li>
                                <li>
                                    <p class="store_address">三明本部六路站（三明市梅列区东新六路）</p>
                                    <p class="contacter">朱燕青 0598-8292953</p>
                                </li>
                                <li>
                                    <p class="store_address">南平本部滨江站 （南平市东教路中段延平区国道205线2129公里300米）</p>
                                    <p class="contacter">吴丽娟 0599- 8832503</p>
                                </li>
                                <li>
                                    <p class="store_address">泉州本部汀州站 （泉州丰泽区宝洲路）</p>
                                    <p class="contacter">欧建伟 0595-22536099</p>
                                </li>
                                <li>
                                    <p class="store_address">龙岩本部罗桥站（龙岩市新罗区西安北路116号）</p>
                                    <p class="contacter">黄丽梅 0597-2290941</p>
                                </li>
                                <li>
                                    <p class="store_address">厦门湖里站（厦门市湖里区湖里兴隆路1号）</p>
                                    <p class="contacter">郑永民 0592- 6023394</p>
                                </li>
                                <li>
                                    <p class="store_address">漳州本部东南站（漳州市芗城区东一号路与马灶路交叉口(现水仙大街51号)）</p>
                                    <p class="contacter">余志鸿  0596-2680755</p>
                                </li>
                            </ul>
                        </div>
                        <div class="bottom_btn_right" onclick="closeGetPlace();">
                            <img src="__PUBLIC__/Images/alert_sure_btn.png"/>
                        </div>
                    </div>
                </div>
    </div>
    <div class="index_bg" >
        <img src="__PUBLIC__/Images/gift_bg.png" style="width:100%;min-height:100%;"/>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    $(function(){
        var arg=location.href.split('?')[1];
        if(arg){
            var isGetGift=1;
            if(isGetGift){
                //中奖时
                var gift_type=2;
                if(gift_type!=4){
                    $("#winGift_jnyz").show();
                }else{
                    $("#winGift_ryb").show();
                }
            }else{
                //没有中奖时
                $("#gainGift").hide();
                $("#noGift").show();
                var restTimes=1;
                if(restTimes){
                    $(".hasGameNum").show();
                    $(".noneGameNum").hide();
                }else{
                    $(".hasGameNum").hide();
                    $(".noneGameNum").show();
                }
            }
        }


        //选择门店
        $("#activity_stores li").click(function(){
            var shop_name = $(this).find('.store_address').text();
            $("input[name='shop']").val(shop_name);
            shop_name = shop_name.substr(0,7)+'...';
            $("#shop_name").text(shop_name);
            closeGetPlace();
        });


        //初始化分享
        fenxiang("助力青运，一路“油”你","助力青运，一路“油”你");
    })

    function fenxiang(title,desc){
        //微信分享
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: "{:C('APPID')}", // 必填，公众号的唯一标识
            timestamp: "{$wxKey['timestamp']}", // 必填，生成签名的时间戳
            nonceStr: "{$wxKey['noncestr']}", // 必填，生成签名的随机串
            signature: "{$wxKey['signature']}",// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
        wx.ready(function () {
            var shareData = {
//            title: '任性！速度进来玩游戏，每天送进口海鲜！连送20天！',
                title: title,
//            desc: '福州电视台首届养生文化节环球海鲜盛宴1月31日开启!微信游戏 抢先上线！',
                desc: desc,
                link: "http://{$_SERVER['HTTP_HOST']}",
                imgUrl: "{:C('APP_URL')}/Public/Images/logo.png"
            };
            wx.onMenuShareAppMessage(shareData);
            wx.onMenuShareTimeline(shareData);
        });
        wx.error(function(res){
            alert(res.errMsg);
        });
    }

    //提交兑奖结果
    function submit_result(){
        var name = $("textarea[name='receiver']").val(),
            phone = $("textarea[name='phone']").val(),
            address = $("textarea[name='address']").val(),
            shop = $("input[name='shop']").val(),
            prize_id = $("input[name='prize_id']").val();

        param = {name:name,phone:phone,address:address,shop:shop,prize_id:prize_id};
        $.post("{:U('Member/Member/getprize')}", param, function(data, textStatus, xhr) {
            if(data.error === 0){
                //成功时

//                title = '幸运儿{$_SESSION["nickname"]}赢得了{$_SESSION["prize_name"]}';
//                desc = '幸运儿{$_SESSION["nickname"]}赢得了{$_SESSION["prize_name"]}';
//                fenxiang(title,desc);

                //返回首页
                location.href="index.html?isWinGift=1";



            }else{
                alert("信息填写不完整，请重新填写！");
            }
        },"json");
    }

    function fenxiang(title,desc){
        //微信分享
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: "{:C('APPID')}", // 必填，公众号的唯一标识
            timestamp: "{$wxKey['timestamp']}", // 必填，生成签名的时间戳
            nonceStr: "{$wxKey['noncestr']}", // 必填，生成签名的随机串
            signature: "{$wxKey['signature']}",// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
        wx.ready(function () {
            var shareData = {
//            title: '任性！速度进来玩游戏，每天送进口海鲜！连送20天！',
                title: title,
//            desc: '福州电视台首届养生文化节环球海鲜盛宴1月31日开启!微信游戏 抢先上线！',
                desc: desc,
                link: "http://{$_SERVER['HTTP_HOST']}",
                imgUrl: "{:C('APP_URL')}/Public/Images/logo.png"
            };
            wx.onMenuShareAppMessage(shareData);
            wx.onMenuShareTimeline(shareData);
        });
        wx.error(function(res){
            alert(res.errMsg);
        });
    }

    //打开礼盒
    function openGift(){
        location.href="advert.html";
    }
    //没有中奖时返回首页
    function backToIndex(){

        location.href="index.html?isWinGift=0";
    }
    function backIndex(){
        location.href="index.html?isWinGift=0";
    }
    function playAgain(){

        location.href="play.html";
    }
    //中燃油宝时查看领奖门店
    function lookStores(){
        $("#getPlace").show();
    }
    //关闭门店弹窗
    function closeGetPlace(){
        $("#getPlace").hide();
    }
    //分享
    function share(){
        $("#share").show();
    }
    //点击分享遮盖层时关闭
    function closeShare(){
        $("#share").hide();
    }
    //关闭中奖弹窗
    function backToIndex(str){
        location.href="index.html?isWinGift=0";
    }

</script>
</body>
</html>